package com.example.demo.utils;

import com.example.demo.enums.ResultEnum;
import com.example.demo.vo.ResultVO;

/**
 * Created by hongzhenyue on 18/2/28.
 */
public class ResultVOUtil {
    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResultEnum.SUCCESS.getCode());
        resultVO.setMsg(ResultEnum.SUCCESS.getMsg());
        if (object != null) {
            resultVO.setData(object);
        }
        return resultVO;
    }

    public static ResultVO success() {
        return success(null);
    }

    public static ResultVO failed(Integer code,String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }
}
